﻿@model IEnumerable<Ring2Park.Models.Vehicle>

@{
    ViewBag.Title = "Manage Vehicles";
}

<h2>Manage Vehicles</h2>

<p>
    @Html.ActionLink("Register new vehicle", "Create")
</p>


<table>
    <tr>
        @if (User.IsInRole("Administrator"))
        {
            <th>
                UserName
            </th>
        }
        <th>
            License
        </th>
        <th>
            Color
        </th>
        <th>
            Preferred
        </th>
        <th>
        </th>
    </tr>
    @foreach (var item in Model)
    {
        <tr>
            @if (User.IsInRole("Administrator"))
            {
                <td>
                    @Html.DisplayFor(modelItem => item.UserName)
                </td>
            }
            <td>
                @Html.DisplayFor(modelItem => item.License)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Color)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Preferred)
            </td>
            <td>
                @Html.ActionLink("Edit", "Edit", new { id = item.VehicleId }) |
                @Html.ActionLink("Details", "Details", new { id = item.VehicleId }) |
                @Html.ActionLink("Delete", "Delete", new { id = item.VehicleId })
            </td>
        </tr>
    }
</table>


